package com.wpp.concurrent.demo3_callable;

import java.util.concurrent.*;

/**
 * @author wpp25
 * @date 2021/6/22 22:21
 * @description：
 */
public class ClientTest2 {

    public static void main(String[] args) throws ExecutionException, InterruptedException {

        ThreadPoolExecutor executor = new ThreadPoolExecutor(5, 5, 1, TimeUnit.SECONDS, new ArrayBlockingQueue<>(10)){
            // callable 出现异常时的执行器
            @Override
            protected void afterExecute(Runnable r, Throwable t) {

                System.out.println("call() error!!!....."+ t);
            }
        };

        System.out.println(executor.submit(new Demo3Callable()).get());
        executor.shutdown();
        System.out.println("main is over");
    }
}
